package dyyx;

import java.time.LocalDateTime;

import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import dyyx.data.Data;

@RestController
public class FeginHelloController {

    @RequestMapping(value = "/fegin/hello")
    public Data hello(@RequestBody  Data data) throws Exception {    	
    	return data; 	
    }
          
    @RequestMapping(value = "/fegin/hello2")
    public String hello2(@RequestParam("name")  String name) throws Exception { 
    	// 模拟异常
    	if(name!=null && name.indexOf("error")>=0){
    		throw new Exception(name);
    	}
    	return "hello,"+name+" from "+HostInfoUtil.getHostIp()+","+LocalDateTime.now(); 	
    }
}